import request from '@/utils/request.js'

/**
 * 获取设备类型信息
 */
export function getEquipmentType(params) {
	return request.post({
		url: "/equipment/v3/eqType/page",
		params,
		paramType: "post"
	})
}

/**
 * 根据RFID标识码获取设备信息
 */
export function getRfidNoByEq(rfidNo){
	return request.get({
		url: "/equipment/v3/eqLocation/getRfidNoByEq",
		params: { rfidNo },
		loading: false
	})
}

/**
 * 通过id查询设备位置信息
 */
export function getEqLocationInfo(id){
	return request.get({
		url: "/equipment/v3/eqLocation/queryById",
		params: { id },
		loading: false
	})
}

/**
 * 通过设备位置编码查询设备位置基本信息
 */
export function getEqLocationByLocaNo(locaNo){
	return request.get({
		url: "/equipment/v3/eqLocation/getEqLocationByLocaNo",
		params: { locaNo },
		loading: false
	})
}

/**
 * 获得顶级设备位置树
 */
export function getTopTreeList(companyId){
	return request.get({
		url: "/equipment/v3/eqLocation/getTopTreeList",
		params: { companyId },
		loading: false
	})
}

/**
 * 根据设备位置id查询下级设备位置
 */
export function getSubTreeList(locaId){
	return request.get({
		url: "/equipment/v3/eqLocation/getSubTreeList",
		params: { locaId },
		loading: false
	})
}

/**
 * 分页查询设备位置列表
 */
export function getEqLocationList(params){
	return request.post({
		url: "/equipment/v3/eqLocation/page",
		params,
		paramType: "post"
	})
}

/**
 * 获取设备信息（旧版本设备服务，后期删除）
 */
export function getEquipmentLocation(pager, params) {
	return request.post({
		url: '/device/v3/equipmentLocation/query',
		pager,
		params,
		type: 'platform'
	});
}

/**
 * 初始化设备位置信息（旧版本设备服务，后期删除）
 */
export function initEquipLocationData(locaId, isLeaf) {
	const params = {
		locaId,
		isLeaf
	}
	return request.get({
		url: '/device/v3/equipmentLocation/initEquipLocationData',
		params,
		loading: false
	});
}

/**
 * 根据位置获取设备信息（旧版本设备服务，后期删除）
 */
export function getEqLocationWithAssetByLocaID(pager, params) {
	return request.post({
		url: '/device/v3/equipmentLocation/getEqLocationWithAssetByLocaID',
		pager,
		params,
		type: 'platform',
		paramType: "post"
	});
}


// 根据区域id查询区域下的视频监控点和门禁点以及电子围栏
export function getIsCamerasDoorsByAreaId(areaId){
	return request.get({
		url: "/equipment/v3/iotAreaDevice/getIsCamerasDoorsByAreaId",
		params: { areaId },
		loading: false
	})
}

// 通过id查询区域信息
export function getEqAreaById(id){
	return request.get({
		url: "/equipment/v3/eqArea/queryById",
		params: { id },
		loading: false
	})
}